-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Fix Azure OpenAI API version duplication #5806
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Add URL parsing utility to extract API version from Base URL - Modify OpenAI provider to use extracted API version when azureApiVersion field is not set - Update UI to show helpful message when API version is detected in URL - Add comprehensive tests for URL parsing functionality Fixes #5805
| const baseUrl = apiConfiguration?.openAiBaseUrl || "" | ||
| const extractedApiVersion = extractApiVersionFromUrl(baseUrl) | ||
| const isAzureUrl = isAzureOpenAiUrl(baseUrl) | ||
| const showApiVersionExtraction = isAzureUrl && extractedApiVersion && !azureApiVersionSelected |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable 'showApiVersionExtraction' is computed based on the extracted API version from the Base URL but is not used anywhere in the UI. Consider using it to display a notice (or auto-fill the Azure API version field) to help users understand that the API version was detected from their Base URL, thereby reducing configuration duplication.
- Fix security vulnerability in URL validation by using endsWith instead of includes - Add UI notification for detected API version from Base URL - Add validation for Azure API version format - Improve test coverage with edge cases - Exclude Azure AI Inference Service URLs from Azure OpenAI detection
webview-ui/src/components/settings/providers/OpenAICompatible.tsx
Outdated
Show resolved
Hide resolved
- Add translation key 'azureApiVersionDetected' to English locale - Update OpenAICompatible component to use translation function - Addresses Ellipsis bot comment about internationalization
- Improve Azure URL detection logic to be more specific - Add visual validation for manually entered Azure API versions in UI - Import isValidAzureApiVersion function for input validation - Add border color styling to indicate valid/invalid API version format
- Added translations for 'azureApiVersionDetected' key in all supported languages - Translations inform users when API version is auto-detected from Base URL - Covers languages: ca, de, es, fr, hi, id, it, ja, ko, nl, pl, pt-BR, ru, tr, vi, zh-CN, zh-TW
- Extract API version from URL for both Azure OpenAI and Azure AI Inference - Keep original URL unchanged to maintain backward compatibility - API version is still sent in both URL and parameter as before - Only the user experience changes (no need to specify version twice)
daniel-lxs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
…nai-api-version-duplication
|
Has anyone been able to test this one? |

Fixes #5805 - Eliminates the need to specify API version in both Base URL and separate field for Azure OpenAI
Important
This PR refines Azure OpenAI API version handling by extracting the version from the URL, reducing configuration redundancy, and updating the UI to reflect detected versions.
OpenAiHandlerinopenai.tsnow extracts Azure API version from URL if not explicitly set, reducing redundancy.extractApiVersionFromUrl()and related functions inazure-url-parser.ts.azure-url-parser.test.ts.OpenAICompatible.tsxupdated to show detected API version if not manually set.This description was created by
for 0f12000. You can customize this summary. It will automatically update as commits are pushed.